package io.renren.modules.service.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.service.dao.MobileWorkerDao;
import io.renren.modules.service.entity.MobileWorkerEntity;
import io.renren.modules.service.service.MobileWorkerService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("mobileWorkerService")
public class MobileWorkerServiceImpl extends ServiceImpl<MobileWorkerDao, MobileWorkerEntity> implements MobileWorkerService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<MobileWorkerEntity> page = new Query<MobileWorkerEntity>().getPage(params);
        List<Map<String, Object>> list = baseMapper.queryPage(params, page);

        return new PageUtils(list, (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
    }

    @Override
    public String queryWorkerNameByDeviceId(Integer deviceId) {
        return baseMapper.queryWorkerNameByDeviceId(deviceId);
    }

}
